package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 攻略点评mapper接口
 */
public interface StrategyCommentMapper {
    int deleteByPrimaryKey(Long id);

    int insert(StrategyComment record);

    StrategyComment selectByPrimaryKey(Long id);

    int updateByPrimaryKey(StrategyComment record);

    List<StrategyComment> selectForList(QueryObject qo);

    /**
     * 改变点评状态
     * @param id
     * @param state
     * @param releaseTime
     */
    void changeStrategyCommentState(@Param("id") Long id, @Param("state") Integer state, @Param("releaseTime") Date releaseTime);

    void changeStrategyCommentCommend(@Param("id") Long id, @Param("isCommend") Integer isCommend);

    void updateGreatCount(@Param("greats") Integer greats, @Param("strategyCommentId") Long strategyCommentId);

    /**
     * 根据作者id查询名下所有的攻略点评
     * @param qo
     * @return
     */
    List getStrategyCommentsByAuthorId(QueryObject qo);

    /**
     * 更新评论数
     * @param count
     */
    void updateReplyCount(@Param("strategyCommentId") Long strategyCommentId, @Param("count") int count);

    /**
     * 根据作者id查询名下所有的攻略点评的数量
     * @param qo
     * @return
     */
    Integer getCountByAuthorId(QueryObject qo);
}